home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
asmsrc
/
lsdminitrain.lha
/
mini_trainer.s
next >
Wrap
Text File
|
1989-08-11
|
10KB
|
561 lines
Section Copperlist,code_C
opt c-
move.l #screenlen,d0
move.l #screen,a0
clear:
move.l #0,(a0)+
sub.l #4,d0
bpl.s clear
move.l 4.w,a6 ; open graphics lib
jsr -$84(a6) ; suspend all current tasks
lea glib,a1
moveq #0,d0
move.l 4.w,a6
jsr -$228(a6)
tst d0
beq error
move.l D0,graphics ; store address of graphics lib
lea dlib,a1
moveq #0,d0
move.l 4.w,a6
jsr -$228(a6)
tst d0
beq error
move.l d0,dos
move.l #Screen,d0 ; store address of bitplane0
move.w d0,bitplane0_lo ; into the copper list
swap d0
move.w d0,bitplane0_hi
lea text,a1
move.l graphics,a6
add.l #$32,a6
move.w #$80,$dff096 ; dma control write
move.l (a6),old_copper ; store the address of the
move.l #my_copper,(a6) ; old copperlist
move.w #$8080,$dff096 ; dma control write
move.w #$8010,$dff09a ; interupt enable bits
move.l $6c.w,old_interupt ; store old level 3 int
move.l #new_interupt,$6c.w ; store my routine
jsr setup_screen
move.w #0,mini_scroll1
move.w #0,mini_scroll2
move.l #16,$100
loopy: jsr do_scrolling_menus
sub.l #1,$100
bpl.s loopy
move.w #(default-1)*16*256,$dff036
bchg #1,$bfe001 ; ? clear mouse button
mouse: btst #6,$bfe001
bne.s mouse ; wait for lmb
bchg #1,$bfe001
move.l old_interupt,$6c.w ; resore old level 3 int
move.l #$10,$dff09a ; Disable Level 3 Interupt
move.l graphics,a6
add.l #$32,a6
move.w #$0080,$dff096
move.l old_copper,(a6) ; restore old copper list
move.w #$8080,$dff096
move.l graphics,a1
move.l 4.w,a6
jsr -$19e(a6)
move.l 4.w,a6
jsr -138(a6)
move.w ypos,d0
mulu #4,d0
move.l d0,a0
lea runtable,a1
adda.l a1,a0
move.l (a0),a1
run_again:
move.b (a1),d0
beq.s error
move.l dos,a6
move.l a1,d1
clr d2
clr d3
movem.l d0-d7/a0-a6,-(sp)
jsr -$de(a6)
movem.l (sp)+,d0-d7/a0-a6
next_run:
move.b (a1)+,d0
bne.s next_run
bra.s run_again
Error: moveq #0,d0
rts
wait_button:
mouse2: btst.b #6,$bfe001
beq.s mouse2
mouse3: btst.b #6,$bfe001
bne.s mouse3
rts
new_interupt:
movem.l d0-d7/a0-a6,-(sp)
and.w #$10,$dff01e
beq no_music
move.w #$10,$dff09c
skip:
move.w #0,mini_colour1
move.w #0,mini_colour2
move.w $dff00a,d0
lsr.w #8,d0
divu #divider,d0
cmp.w #max,d0
blt.s mousey_ok
cmp.w #6,d0
bgt.s neg_mouse
move.w #(max-1)*divider*256,$dff036
move.w ypos,d0
bra.s mousey_ok
neg_mouse:
move.w #0,$dff036
move.w #0,d0
mousey_ok:
move.w d0,ypos
mulu #4,d0
move.l d0,a0
lea lookup,a1
adda.l a1,a0
move.l (a0),a1
move.w #barcolour,(a1)
wait_irq:
sine_ok:
no_music:
movem.l (sp)+,d0-d7/a0-a6
dc.w $4ef9 ; jmp
old_interupt: dc.l 0 ; the old int lev 3
do_blit:
btst.b #6,$dff002
Bne.s do_blit
rts
setup_screen:
lea mes1,a1
move.w #0,d7
move.l #screen+(01*46)+2,a2
jsr blit_message
move.w #0,d7
move.l #screen+(20*46)+2,a2
jsr blit_message
rts
blit_message:
move.l a1,a6
add.l #3,a2
clr.b d0
move.l #2,d1
blit_message_loop1:
add.l #1,d1
move.b (a6),d0
addq #1,a6
cmp.b #0,d0
bne.s blit_message_loop1
move.w d1,d7
and.w #1,d7
mulu #8192*4,d7
move.l #23,a6
sub.l d1,a6
add.l a6,a2
cont_blit_message:
clr.w d0
lea font,a0
move.b (a1),d0
add.l #1,a1
cmp.b #0,d0
bne.s mess_is_ok
rts
mess_is_ok:
sub #32,d0
mulu #32,d0
add d0,a0
Move.l a2,$dff054 ; dest mem d
Move.l a0,$dff050 ; source mem a
move.l a2,$dff048 ; source mem c
Move.w #$ffff,$dff044 ; blit 1st word mask source a
move.w #$0000,$dff046 ; blit last word mask source a
move.w #-2,$dff064 ; blit modulo for source a
move.w #42,$dff060 ; blit modulo for source c
or.w #(%1011*256)+$fa,d7
move.w d7,$dff040 ; blit cont reg 0
move.w #0,$dff042 ; blit cont reg 1
Move.w #42,$dff066 ; modulo for dest
Move.w #(16*64)+2,$dff058 ; blit height,width
jsr do_blit
add.l #2,a2
bra cont_blit_message
tadd equ 230*46
scroll_text:
RTS
do_scrolling_menus:
lea mini_scroll1,a0
move.l scrollpoint1,a1
move.l #screen+(58*46),a2
lea scrollpoint1,a3
lea scroller1,a4
jsr update_menus
lea mini_scroll2,a0
move.l scrollpoint2,a1
move.l #screen+(78*46),a2
lea scrollpoint2,a3
lea scroller2,a4
jsr update_menus
rts
scroller_is_ok:
move.w d7,(a0)
rts
update_menus:
move.l a2,a5
move.l a2,a6
add.l #2,a6
Move.l a5,$dff054 ; dest mem
Move.l a6,$dff050 ; source mem
Move.w #$ffff,$dff044
move.w #$ffff,$dff046
move.l #0,$dff064 ; blit modulo for source a
Move.w #%100111110000,$dff040 ; blit cont reg 0
move.w #0,$dff042 ; blit cont reg 1
Move.w #0,$dff066 ; modulo for dest
Move.w #(44*64)+8,$dff058 ; blit width,height
jsr do_blit
clr.w d0
lea font,a0
move.b (a1),d0
addq.l #1,(a3)
cmp.b #0,d0
bne.s ascii_is_ok2
move.l a4,(a3)
move.l #32,d0
ascii_is_ok2:
sub #32,d0
mulu #32,d0
add d0,a0
move.l a2,a6
add.l #44,a6
Move.l a6,$dff054 ; dest mem
Move.l a0,$dff050 ; source mem
Move.l #$ffffffff,$dff044 ; blit mask source a
move.l #1,$dff064 ; blit modulo for source a
Move.w #%100111110000,$dff040 ; blit cont reg 0
move.w #0,$dff042 ; blit cont reg 1
Move.w #44,$dff066 ; modulo for dest
Move.w #%0000010000000001,$dff058 ; blit width,height
; [hhhhhhhhhhwwwwww]
jsr do_blit
rts
Section copdat,Data_c
scrollpoint1: dc.l scroller1
scrollpoint2: dc.l scroller2
sine_list:
dc.w 43
dc.w 48
dc.w 54
dc.w 60
dc.w 65
dc.w 70
dc.w 74
dc.w 78
dc.w 81
dc.w 83
dc.w 85
dc.w 85
dc.w 85
dc.w 84
dc.w 82
dc.w 80
dc.w 76
dc.w 72
dc.w 68
dc.w 63
dc.w 57
dc.w 51
dc.w 45
dc.w 40
dc.w 34
dc.w 28
dc.w 22
dc.w 17
dc.w 13
dc.w 9
dc.w 5
dc.w 3
dc.w 1
dc.w 0
dc.w 0
dc.w 0
dc.w 2
dc.w 4
dc.w 7
dc.w 11
dc.w 15
dc.w 20
dc.w 25
dc.w 31
dc.w 37
sine_end:
old_copper: dc.l 0
even
my_copper: dc.w $100,$1200 ; 1 bp - lores -
dc.w $104,$a ; bp control reg
dc.w $108,0 ; bp modulo - odd
dc.w $10a,0 ; bp modulo - even
dc.w $180,0
dc.w $102,0
dc.w $120,0,$122,0
dc.w $092,$28 ; bp start horz
dc.w $094,$d8 ; bp stop horz
dc.w $08e,$2c72 ; bp window start left
dc.w $090,$2cc6 ; bp window bot right
dc.w $0e0 ; bp 1 address hi-byte
bitplane0_hi: dc.w 0
dc.w $e2 ; bp 1 address
bitplane0_lo: dc.w 0
dc.w $2aff,$ff00,$180,$fff,$2bff,$ff00,$180,titlebg
dc.w $102,0
dc.w $2dff,$ff00,$182,$880
dc.w $2eff,$ff00,$182,$990
dc.w $2fff,$ff00,$182,$aa0
dc.w $30ff,$ff00,$182,$bb0
dc.w $31ff,$ff00,$182,$cc0
dc.w $32ff,$ff00,$182,$dd0
dc.w $33ff,$ff00,$182,$ee0
dc.w $34ff,$ff00,$182,$ff0
dc.w $35ff,$ff00,$182,$ee0
dc.w $36ff,$ff00,$182,$dd0
dc.w $37ff,$ff00,$182,$cc0
dc.w $38ff,$ff00,$182,$bb0
dc.w $39ff,$ff00,$182,$aa0
dc.w $3aff,$ff00,$182,$990
dc.w $3bff,$ff00,$182,$880
dc.w $3cff,$ff00,$182,$770
dc.w $3dff,$ff00,$182,$ff0
dc.w $102,0
dc.w $40ff,$ff00,$182,$880
dc.w $41ff,$ff00,$182,$990
dc.w $42ff,$ff00,$182,$aa0
dc.w $43ff,$ff00,$182,$bb0
dc.w $44ff,$ff00,$182,$cc0
dc.w $45ff,$ff00,$182,$dd0
dc.w $46ff,$ff00,$182,$ee0
dc.w $47ff,$ff00,$182,$ff0
dc.w $48ff,$ff00,$182,$ee0
dc.w $49ff,$ff00,$182,$dd0
dc.w $4aff,$ff00,$182,$cc0
dc.w $4bff,$ff00,$182,$bb0
dc.w $4cff,$ff00,$182,$aa0
dc.w $4dff,$ff00,$182,$990
dc.w $4eff,$ff00,$182,$880
dc.w $4fff,$ff00,$182,$770
dc.w $51ff,$ff00,$180,$fff,$52ff,$ff00,$180,$000
dc.w $102
mini_scroll1: dc.w 0
dc.w $65ff,$ff00,$182,$880
dc.w $180
mini_colour1: dc.w $fff
dc.w $66ff,$ff00,$182,$990
dc.w $67ff,$ff00,$182,$aa0
dc.w $68ff,$ff00,$182,$bb0
dc.w $69ff,$ff00,$182,$cc0
dc.w $6aff,$ff00,$182,$dd0
dc.w $6bff,$ff00,$182,$ee0
dc.w $6cff,$ff00,$182,$ff0
dc.w $6dff,$ff00,$182,$ee0
dc.w $6eff,$ff00,$182,$dd0
dc.w $6fff,$ff00,$182,$cc0
dc.w $70ff,$ff00,$182,$bb0
dc.w $71ff,$ff00,$182,$aa0
dc.w $72ff,$ff00,$182,$990
dc.w $73ff,$ff00,$182,$880
dc.w $74ff,$ff00,$182,$770
dc.w $76ff,$ff00,$180,$000
dc.w $78ff,$ff00,$102
mini_scroll2: dc.w 0
dc.w $79ff,$ff00,$182,$880
dc.w $180
mini_colour2: dc.w $fff
dc.w $7aff,$ff00,$182,$990
dc.w $7bff,$ff00,$182,$aa0
dc.w $7cff,$ff00,$182,$bb0
dc.w $7dff,$ff00,$182,$cc0
dc.w $7eff,$ff00,$182,$dd0
dc.w $7fff,$ff00,$182,$ee0
dc.w $80ff,$ff00,$182,$ff0
dc.w $81ff,$ff00,$182,$ee0
dc.w $82ff,$ff00,$182,$dd0
dc.w $83ff,$ff00,$182,$cc0
dc.w $84ff,$ff00,$182,$bb0
dc.w $85ff,$ff00,$182,$aa0
dc.w $86ff,$ff00,$182,$990
dc.w $87ff,$ff00,$182,$880
dc.w $88ff,$ff00,$182,$770
dc.w $8aff,$ff00,$180,$000
dc.w $9dff,$ff00,$180,$fff
dc.w $9eff,$ff00,$180,$000
dc.w $ffe1,$fffe ; wait for end of ntsc screen
dc.w $3001,$ff00 ; wait for end of pal screen
dc.w $9c,$8010 ; irq set bits - re-call my interupt
dc.w $ffff,$fffe ; end of copper list
glib: dc.b "graphics.library",0
even
dlib: dc.b "dos.library",0
even
graphics: dc.l 0
dos: dc.l 0
count: dc.l 0
delay: dc.l 0
sine_pos: dc.l sine_list
bounce equ 144
screenlen equ 46*348
screen equ $70000
ypos: dc.l 0
lookup: dc.l mini_colour1
dc.l mini_colour2
runtable: dc.l run1
dc.l run2
dc.l run3
dc.l run4
dc.l run5
font: incbin "df1:twenties.small"
text:
mes1: dc.b "ESCAPE FROM THARKAN ",0
dc.b "TRAINED BY CASCADE ",0 ; needs two lines!
divider equ 26
barcolour equ $02F ; colour of highlight
titlebg equ $444 ; colour of background of title
default equ 1 ; menu item which is selected on loading (1-5)
max equ 2 ; maxumum number of items on the menu (1-5)
; run1-5
; commands to execute!!
; finish with 0
run1: dc.b "game",0,0
even
run2:
dc.b "trainer",0,0
even
run3:
dc.b "",0
dc.b "",0,0
even
run4:
dc.b "",0,0
even
run5:
dc.b "",0,0
even
scroller1: dc.b "NORMAL GAME ",0
scroller2: dc.b " TRAINER ",0
End